package com.suray.wcs.service.pojo;

import com.suray.basic.wcs.utils.ModuleType;
import com.suray.rgv.RgvForkInterface;
import com.suray.wcs.res.enums.PalletStatus;
import com.suray.wcs.service.system.entity.RgvDB;

public class RgvFork extends Rgv60 {
    /**
     * 每一个DB对象对应一个业务对象
     *
     * @param rgvDB
     * @param rgvForkCore
     * @param moduleType
     */
    public RgvFork(RgvDB rgvDB, RgvForkInterface rgvForkCore, ModuleType moduleType) {
        super(rgvDB, rgvForkCore, moduleType);
    }

    public RgvForkInterface getRgvCore() {
        return (RgvForkInterface) rgvCore;
    }

    public void resetForkParam() {
        RgvForkInterface rgvForkInterface = (RgvForkInterface) rgvCore;
        rgvForkInterface.setForkHeightErrorRange(getRgvDB().getForkHeightErrorRange());
        rgvForkInterface.setRgvForkLiftDis(getRgvDB().getForkLiftDis());
        rgvForkInterface.setRgvForkLiftDownHeight(getRgvDB().getForkLiftDownHeight());
    }

    @Override
    public PalletStatus getPalletStatus() {
        return ((RgvForkInterface) rgvCore).isForkDown() ? PalletStatus.DOWN : PalletStatus.UP;
    }
}
